inline GnMemoryManager* GnMemoryManager::Instance()
{
	return msMemManager;
}

inline void* GnMemoryManager::Allocate(gsize stSizeInBytes, gsize stAlignment,
	GnMemoryEventType eEventType, bool bProvideAccurateSizeOnDeallocate,
	const char *pcSourceFile, int iSourceLine, const char* pcFunction)
{
	GnAssert(mAllocator);

	void* pvMem = ALLOCTOR_ALLOCATE(stSizeInBytes, stAlignment, eEventType, bProvideAccurateSizeOnDeallocate, 
		pcSourceFile, iSourceLine, pcFunction);

	return pvMem;
}

inline void* GnMemoryManager::Reallocate(void* pvMem, gsize stSizeInBytes, 
	gsize stAlignment, GnMemoryEventType eEventType, bool bProvideAccurateSizeOnDeallocate,
	gsize stSizeCurrent, const char *pcSourceFile, int iSourceLine, const char* pcFunction)
{
	GnAssert(mAllocator);

	void* pvNewMem = ALLOCTOR_REALLOCATE(pvMem, stSizeInBytes, stAlignment, eEventType,
		bProvideAccurateSizeOnDeallocate, stSizeCurrent, pcSourceFile, iSourceLine, pcFunction);
	return pvNewMem;
}

inline  void GnMemoryManager::Deallocate(void* pvMem,
	GnMemoryEventType eEventType, gsize stSizeinBytes)
{
	GnAssert(mAllocator);

	mAllocator->Deallocate(pvMem, eEventType, stSizeinBytes);

}

inline bool GnMemoryManager::TrackAllocate(const void* const pvMem,  
	gsize stSizeInBytes, GnMemoryEventType eEventType, 
	const char *pcSourceFile, int iSourceLine, const char* pcFunction)
{
	GnAssert(mAllocator);

#ifdef GN_MEMORY_DEBUGGER
	return mAllocator->TrackAllocate(pvMem, stSizeInBytes, eEventType, pcSourceFile, iSourceLine, pcFunction);
#else
	return false;
#endif	
}

inline  bool GnMemoryManager::TrackDeallocate(const void* const pvMem, GnMemoryEventType eEventType)
{
	GnAssert(mAllocator);

#ifdef GN_MEMORY_DEBUGGER
	return mAllocator->TrackDeallocate(pvMem, eEventType);
#else
	return false;
#endif	
	
}

inline const char* GnMemoryManager::GnMemoryEventTypeToString(GnMemoryEventType eEventType)
{
	switch (eEventType)
	{
	case GN_UNKNOWN:
		return "GN_UNKNOWN";
	case GN_OPER_NEW:
		return "GN_OPER_NEW";
	case GN_OPER_NEW_ARRAY:
		return "GN_OPER_NEW_ARRAY";
	case GN_OPER_DELETE:
		return "GN_OPER_DELETE";
	case GN_OPER_DELETE_ARRAY:
		return "GN_OPER_DELETE_ARRAY";
	case GN_MALLOC:
		return "GN_MALLOC";
	case GN_REALLOC:
		return "GN_REALLOC";
	case GN_ALIGNEDMALLOC:
		return "GN_ALIGNEDMALLOC";
	case GN_ALIGNEDREALLOC:
		return "GN_ALIGNEDREALLOC";
	case GN_FREE:
		return "GN_FREE";
	case GN_ALIGNEDFREE:
		return "GN_ALIGNEDFREE";
	case GN_EXTERNALALLOC:
		return "GN_EXTERNALALLOC";
	case GN_EXTERNALFREE:
		return "GN_EXTERNALFREE";
	default:
		GnAssert(!"Unknown GnMemoryEventType  value!");
	};

	return NULL;
}
//---------------------------------------------------------------------------
